<script src="https://unpkg.com/axios/dist/axios.min.js"></script>

<!-- axios  做配置， 每次axios请求， 都会来到这里 -->
<!-- 拦截我们的请求 -->
<!-- interceptors 拦截器 -->
<script>
    axios.interceptors.request.use(function(config) {
        const token = localStorage.getItem('token')
        if (token) {
            config.headers.common['Authorization'] = token
        }
        return config
    })
</script>